package acm.pta;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class T_13 {
    static int[][][] a = new int[60][1300][130];
    static int[][][] b = new int[60][1300][130];
    static int n, m, l, t, res = 0;
    static int[] nx = {1, -1, 0, 0, 0, 0};
    static int[] ny = {0, 0, 1, -1, 0, 0};
    static int[] nz = {0, 0, 0, 0, 1, -1};

    static class Node {
        int x, y, z;

        Node(int x, int y, int z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }
    }

    static boolean check(int x, int y, int z) {
        return x >= 0 && x < l && y >= 0 && y < m && z >= 0 && z < n && a[x][y][z] == 1 && b[x][y][z] == 0;
    }

    static void bfs(int x, int y, int z) {
        Queue<Node> q = new LinkedList<>();
        q.add(new Node(x, y, z));
        b[x][y][z] = 1;
        int tmp = 0;
        while (!q.isEmpty()) {
            Node t = q.poll();
            tmp++;
            int tx = t.x, ty = t.y, tz = t.z;
            for (int i = 0; i < 6; i++) {
                int xx = tx + nx[i], yy = ty + ny[i], zz = tz + nz[i];
                if (check(xx, yy, zz)) {
                    b[xx][yy][zz] = 1;
                    q.add(new Node(xx, yy, zz));
                }
            }
        }
        if (tmp >= t) res += tmp;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        m = scanner.nextInt();
        n = scanner.nextInt();
        l = scanner.nextInt();
        t = scanner.nextInt();
        for (int i = 0; i < l; i++)
            for (int j = 0; j < m; j++)
                for (int k = 0; k < n; k++)
                    a[i][j][k] = scanner.nextInt();
        for (int i = 0; i < l; i++)
            for (int j = 0; j < m; j++)
                for (int k = 0; k < n; k++)
                    if (a[i][j][k] == 1 && b[i][j][k] == 0)
                        bfs(i, j, k);
        System.out.println(res);
    }
}

